//
//  JRHttpRequestConfiguration.swift
//  JRHttpRequestManager
//
//  Created by 京睿 on 2017/4/26.
//  Copyright © 2017年 JingRuiWangKe. All rights reserved.
//

import UIKit
import AFNetworking
import JRAPIManager
import JRKeyChain

public typealias kConfig = JRHttpRequestConfiguration
public class JRHttpRequestConfiguration: NSObject {
    public static var baseUrl: String! = JRBaseApi().rawValue
    public static var acceptableContentTypes: Set<String> = ["application/json"]
    public static var responseSerializer: AFHTTPResponseSerializer = AFHTTPResponseSerializer()
    public static var headers: [String: String] = [:]
    public static var timeoutInterval: TimeInterval = 60
    public static var encryptionManager: JRHttpRequestEncryptionInterface = JRMD5EncryptionManager()
    
    public final class JRInfo {
        /// 版本号
        static public var version   = Bundle.main.infoDictionary!["CFBundleShortVersionString"] as! String
        /// 设备类型
        static public var device    = "iOS"
        /// 设备标识
        static public var deviceid  = JRKeyChain.uuid
    }   
}

extension JRHttpRequestConfiguration {
    public static let successField:        String      = "statusCode"
    public static let successCode:         NSNumber    = -1
    public static let failingDescField:    String      = "errorMessage"
}
